package com.note.feng.stateMachine;

import com.note.feng.stateMachine.event.Event;
import com.note.feng.stateMachine.utils.ActionEnum;
import com.note.feng.stateMachine.utils.StateEnum;

/**
 * @author yuhf
 */
public class StateTranaction {

    /**
     * 当前状态
     */
    private StateEnum currentState;

    /**
     * 相对应动作
     */
    private ActionEnum action;

    /**
     * 下一个状态
     */
    private StateEnum nextState;

    /**
     * 事件
     */
    private Event event;

    public StateTranaction(){

    }

    public StateEnum getCurrentState() {
        return currentState;
    }

    public ActionEnum getAction() {
        return action;
    }

    public StateEnum getNextState() {
        return nextState;
    }

    public Event getEvent() {
        return event;
    }

    /**
     * 链式初始化对象
     */
    public StateTranaction source(StateEnum state){
        this.currentState = state;
        return this;
    }

    public StateTranaction when(ActionEnum action){
        this.action = action;
        return this;
    }

    public StateTranaction targer(StateEnum state){
        this.nextState = state;
        return this;
    }

    public StateTranaction how(Event event){
        this.event = event;
        return this;
    }

}
